home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
EDUCATE
/
CATTEST.ARJ
/
FLAMETMP.IN1
< prev
next >
Wrap
Text File
|
1991-03-04
|
10KB
|
321 lines
PROCEDURE Init_Question;
VAR
dummy_i {integer, may be deleted}
{integer variables follow:}
: Integer;
{real variables follow:}
dummy_r {real, may be deleted}
,R_Heat_of_Formation_CH4
,R_Heat_of_Formation_CO2
,R_Heat_of_Formation_h2o
,R_cp_CO2
,R_cp_H2o
,R_cp_n2
,R_Heat_of_Combustion
,R_cp_product_gases
,R_final_temperature
: Real;
{string variables follow:}
dummy_s {string, may be deleted}
,A_R_Heat_of_Formation_CH4
,A_R_Heat_of_Formation_CO2
,A_R_Heat_of_Formation_h2o
,A_R_cp_CO2
,A_R_cp_H2o
,A_R_cp_n2
,A_R_Heat_of_Combustion
,A_R_cp_product_gases
,A_R_final_temperature
: String;
BEGIN
{$I-}
Assign (OldQuestionFile,Progname_string+'.SAV');
Reset(OldQuestionFile);
{$I+}
IF IOResult = 0 THEN {this is a repeat, there was a .SAV file}
BEGIN
ReadLn(OldQuestionFile,R_Heat_of_Formation_CH4);
ReadLn(OldQuestionFile,R_Heat_of_Formation_CO2);
ReadLn(OldQuestionFile,R_Heat_of_Formation_h2o);
ReadLn(OldQuestionFile,R_cp_CO2);
ReadLn(OldQuestionFile,R_cp_H2o);
ReadLn(OldQuestionFile,R_cp_n2);
ReadLn(OldQuestionFile,R_Heat_of_Combustion);
ReadLn(OldQuestionFile,R_cp_product_gases);
ReadLn(OldQuestionFile,R_final_temperature);
Close(OldQuestionFile);
END
else {there was no .SAV file, must generate new values}
BEGIN
{question creation section
creating new values for student variables}
R_Heat_of_Formation_CH4 := -74.81;
R_Heat_of_Formation_CO2 := -395.51;
R_Heat_of_Formation_h2o := -241.82;
R_cp_CO2 := 37.11;
R_cp_H2o := 33.58;
R_cp_n2 := 29.12;
R_Heat_of_Combustion := R_Heat_of_Formation_CO2+2.*R_Heat_of_Formation_h2o-R_Heat_of_Formation_CH4;
R_cp_product_gases := R_cp_co2 + 2.*R_cp_h2o+8.*R_cp_n2;
R_final_temperature := 298.-R_Heat_of_Combustion*(1.E3)/R_cp_product_gases;
ReWrite(OldQuestionFile);{ create the .SAV file just in case
student needs to quit and do it again}
WriteLn(OldQuestionFile,R_Heat_of_Formation_CH4);
WriteLn(OldQuestionFile,R_Heat_of_Formation_CO2);
WriteLn(OldQuestionFile,R_Heat_of_Formation_h2o);
WriteLn(OldQuestionFile,R_cp_CO2);
WriteLn(OldQuestionFile,R_cp_H2o);
WriteLn(OldQuestionFile,R_cp_n2);
WriteLn(OldQuestionFile,R_Heat_of_Combustion);
WriteLn(OldQuestionFile,R_cp_product_gases);
WriteLn(OldQuestionFile,R_final_temperature);
Close(OldQuestionFile)
END;
STR(R_Heat_of_Formation_CH4:4:2,A_R_Heat_of_Formation_CH4);
STR(R_Heat_of_Formation_CO2:4:2,A_R_Heat_of_Formation_CO2);
STR(R_Heat_of_Formation_h2o:4:2,A_R_Heat_of_Formation_h2o);
STR(R_cp_CO2:4:2,A_R_cp_CO2);
STR(R_cp_H2o:4:2,A_R_cp_H2o);
STR(R_cp_n2:4:2,A_R_cp_n2);
STR(R_Heat_of_Combustion:4:2,A_R_Heat_of_Combustion);
STR(R_cp_product_gases:4:2,A_R_cp_product_gases);
STR(R_final_temperature:4:2,A_R_final_temperature);
question := ' For a stoichiometrically exact methane flame, assuming one mole of methane, ';
question := question + ' calculate the theoretical flame temperature.';
question := question + ' Cp CO2 = ' + A_R_cp_CO2+' Delta_H(f) CO2 = ' + A_R_Heat_of_Formation_CO2;
question := question + ' , Delta_H(f) CH4 = ' + A_R_Heat_of_Formation_CH4;
question := question + ' , Cp H2O = ' + A_R_cp_H2O+' and Delta_H(f) H2O ' + A_R_Heat_of_Formation_H2O;
question2 := 'while the Cp N2 = '+ A_R_cp_N2+' (in J/mole[cp] and kJ/mol[heats of formation]).';
If MaxAvail < Sizeof(Wrong_Answers) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(RootErrorPtr);
TempPtr := RootErrorPtr;
TempPtr^.next := nil;
TempPtr^.value := R_Heat_of_Combustion*(1.E3)/R_cp_product_gases;
TempPtr^.remark := 'Did you compute Delta(T)?';
END;
If MaxAvail < Sizeof(Wrong_Answers) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempPtr);
TempPtr^.next := GenTempPtr;
TempPtr := GenTempPtr;
TempPtr^.next := nil;
TempPtr^.value := R_Heat_of_Combustion;
TempPtr^.remark := 'Did you compute the Heat of Combustion?';
END;
If MaxAvail < Sizeof(Wrong_Answers) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempPtr);
TempPtr^.next := GenTempPtr;
TempPtr := GenTempPtr;
TempPtr^.next := nil;
TempPtr^.value := 298.+R_Heat_of_Combustion*(1.E3)/R_cp_product_gases;
TempPtr^.remark := 'Did you make a sign error?';
END;
If MaxAvail < Sizeof(Wrong_Answers) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempPtr);
TempPtr^.next := GenTempPtr;
TempPtr := GenTempPtr;
TempPtr^.next := nil;
TempPtr^.value := 298.-R_Heat_of_Combustion/R_Cp_product_gases;
TempPtr^.remark := 'Did you forget a Joule or KJoule conversion?';
END;
If MaxAvail < Sizeof(Wrong_Answers) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempPtr);
TempPtr^.next := GenTempPtr;
TempPtr := GenTempPtr;
TempPtr^.next := nil;
TempPtr^.value := true_answer/1000.;
TempPtr^.remark := 'Did you forget a power of 3?';
END;
true_answer := R_final_temperature;
{$IFDEF Watch_Student}
WriteLn(Outfile,Time_Stamp);
WriteLn(OutFile,question);
WriteLn(OutFile,'R_Heat_of_Formation_CH4 = ',R_Heat_of_Formation_CH4);
WriteLn(OutFile,'R_Heat_of_Formation_CO2 = ',R_Heat_of_Formation_CO2);
WriteLn(OutFile,'R_Heat_of_Formation_h2o = ',R_Heat_of_Formation_h2o);
WriteLn(OutFile,'R_cp_CO2 = ',R_cp_CO2);
WriteLn(OutFile,'R_cp_H2o = ',R_cp_H2o);
WriteLn(OutFile,'R_cp_n2 = ',R_cp_n2);
WriteLn(OutFile,'R_Heat_of_Combustion = ',R_Heat_of_Combustion);
WriteLn(OutFile,'R_cp_product_gases = ',R_cp_product_gases);
WriteLn(OutFile,'R_final_temperature = ',R_final_temperature);
WriteLn(OutFile,'answer = ',R_final_temperature);
{$ENDIF }
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(RootDebugLinePtr);
TempDebugLinePtr := RootDebugLinePtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_Heat_of_Formation_CH4 = ' + A_R_Heat_of_Formation_CH4;
END;
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempDebugPtr);
TempDebugLinePtr^.next := GenTempDebugPtr;
TempDebugLinePtr := GenTempDebugPtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_Heat_of_Formation_CO2 = ' + A_R_Heat_of_Formation_CO2;
END;
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempDebugPtr);
TempDebugLinePtr^.next := GenTempDebugPtr;
TempDebugLinePtr := GenTempDebugPtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_Heat_of_Formation_h2o = ' + A_R_Heat_of_Formation_h2o;
END;
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempDebugPtr);
TempDebugLinePtr^.next := GenTempDebugPtr;
TempDebugLinePtr := GenTempDebugPtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_cp_CO2 = ' + A_R_cp_CO2;
END;
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempDebugPtr);
TempDebugLinePtr^.next := GenTempDebugPtr;
TempDebugLinePtr := GenTempDebugPtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_cp_H2o = ' + A_R_cp_H2o;
END;
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempDebugPtr);
TempDebugLinePtr^.next := GenTempDebugPtr;
TempDebugLinePtr := GenTempDebugPtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_cp_n2 = ' + A_R_cp_n2;
END;
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempDebugPtr);
TempDebugLinePtr^.next := GenTempDebugPtr;
TempDebugLinePtr := GenTempDebugPtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_Heat_of_Combustion = ' + A_R_Heat_of_Combustion;
END;
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempDebugPtr);
TempDebugLinePtr^.next := GenTempDebugPtr;
TempDebugLinePtr := GenTempDebugPtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_cp_product_gases = ' + A_R_cp_product_gases;
END;
If MaxAvail < Sizeof(Debug_Lines) then
BEGIN
WriteLn('Not enough memory');
Noise(Bad);
halt;
END ELSE
BEGIN
New(GenTempDebugPtr);
TempDebugLinePtr^.next := GenTempDebugPtr;
TempDebugLinePtr := GenTempDebugPtr;
TempDebugLinePtr^.next := nil;
TempDebugLinePtr^.line := 'R_final_temperature = ' + A_R_final_temperature;
END;
END {of .IN1};